package cn.wolfcode.business.mapper;


import cn.wolfcode.business.domain.BusServiceItem;
import cn.wolfcode.business.domain.BusStatement;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@Mapper
public interface BusStatementMapper {
    List<BusServiceItem> getList(BusStatement busStatement);

    BusStatement getStatement(Long id);

    Integer add(BusStatement busStatement);

    Integer update(BusStatement BusStatement);

    Integer delete(@Param("id") Long id, @Param("isDelete") Integer isDelete);

    Long generateStatement(BusStatement busStatement);
    //根据预约id查询结算单ID，用于生成结算单时去重
    BusStatement getBusStatementByAppointId(Long appointId);

    Integer Modify(@Param("id")Long statementId,@Param("totalAmount") BigDecimal totalAmount, @Param("totalQuantity") BigDecimal totalQuantity, @Param("discountPrice") BigDecimal discountPrice);

    /**
     * 点击支付后触发，用于补全结算单表中在支付后才能填充的字段，并更新结算单的状态为已支付
     * @param statementId
     * @param userId
     * @param date
     * @param status
     * @return
     */
    int payUpdateStatement(@Param("statementId") Long statementId, @Param("userId") Long userId, @Param("date") Date date, @Param("status") Integer status);
}
